using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FixedTimeBalance : MonoBehaviour
{
	private List<Rigidbody> m_RigidList;

	private int m_ActiveBalls;

	private IEnumerator Start()
	{
		yield return new WaitForEndOfFrame();
		m_RigidList = new List<Rigidbody>();
		for (int i = 1; i <= 15; i++)
		{
			m_RigidList.Add(Pools.Balls[i].GetComponent<Rigidbody>());
		}
		foreach (KeyValuePair<int, PoolBall> customBall in Pools.CustomBalls)
		{
			m_RigidList.Add(customBall.Value.GetComponent<Rigidbody>());
		}
	}

	private void Update()
	{
		if (Time.frameCount % 2 != 0 || m_RigidList == null)
		{
			return;
		}
		m_ActiveBalls = 0;
		int i = 0;
		for (int count = m_RigidList.Count; i < count; i++)
		{
			if ((bool)m_RigidList[i] && !m_RigidList[i].IsSleeping() && m_RigidList[i].gameObject.activeInHierarchy)
			{
				m_ActiveBalls++;
			}
		}
		float num2 = Time.fixedDeltaTime = ((m_ActiveBalls >= 7) ? 0.005f : ((m_ActiveBalls < 4) ? 0.002f : 0.003f));
	}
}
